package com.zyx.kafka.demo;

import org.apache.kafka.common.serialization.Serdes;
import org.apache.kafka.streams.KafkaStreams;
import org.apache.kafka.streams.StreamsConfig;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: TODO
 * @Author: ZYX
 * @Date: 2021/12/30 14:29
 * @Version: 1.0
 */
public class KafkaStreamDemo {

    public static void main(String[] args) {
//        Map<String, Object> props = new HashMap<>();
//        props.put(StreamsConfig.APPLICATION_ID_CONFIG, "my-stream-processing-application");
//        props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
//        props.put(StreamsConfig.Keys, Serdes.String().getClass().getName());
//        props.put(StreamsConfig.VALUE_SERDE_CLASS_CONFIG, Serdes.String().getClass().getName());
//        StreamsConfig config = new StreamsConfig(props);
//
//        KStreamBuilder builder = new KStreamBuilder();
//        builder.stream("my-input-topic").mapValues(value -> value.length().toString()).to("my-output-topic");
//
//        KafkaStreams streams = new KafkaStreams(builder, config);
//        streams.start();
    }

}
